<template>
  <section class="delivery">
    <div class="delivery-wrap">
      <div class="delivery-time">
        <span class="time">送达时间</span>
        <span class="bird" v-if="shopInfo.delivery_mode.text">{{shopInfo.delivery_mode.text}}</span>
      </div>
      <div class="quike">
        <span>尽快送达({{deliveryTime(shopInfo.order_lead_time)}})</span>
        <i class="fa fa-angle-right"></i>
      </div>
    </div>
    <div class="cart-item">
      <span class="pay">支付方式</span>
      <span>在线支付</span>
    </div>
  </section>
</template>

<script>
export default {
  name: 'MyDelivery',
  methods: {
    deliveryTime(time) {
      const date = new Date()
      date.setMinutes(date.getMinutes() + time)
      let m = date.getMinutes()
      let h = date.getHours()
      m = m > 10 ? m : '0' + m
      h = h > 10 ? h : '0' + h
      return h + ':' + m
    }
  },
  computed: {
    shopInfo() {
      return this.$store.getters.foodSelect.shopInfo
    }
  }
}
</script>

<style lang="less" scoped>
.delivery {
  width: 100%;
  padding: 10px 20px;
  box-sizing: border-box;
  background-color: #fff;
  .delivery-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    .delivery-time {
      display: flex;
      flex-direction: column;
      color: #333;
      .time {
        font-weight: 700;
        font-size: 18px;
      }
      .bird {
        font-size: 12px;
        border: 1px solid #ccc;
        background-color: #009eef;
        font-weight: 600;
        color: #fff;
        text-align: center;
      }
    }
    .quike {
      span {
        color: #009eef;
      }
      i {
        color: #666;
        margin-left: 5px;
      }
    }
  }
  .cart-item {
    display: flex;
    justify-content: space-between;
    color: #333;
    align-items: center;
    padding: 10px 0;
    .pay {
      font-weight: 700;
      font-size: 18px;
      color: #333;
    }
    span {
      color: #009eef;
      font-weight: 600;
    }
  }
}
</style>
